package com.ideal.manage.esms.controller.system;

import com.ideal.manage.esms.bean.DTO.Result;
import com.ideal.manage.esms.service.system.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created By Dai On 2018/5/14
 * Remark: 修改密码
 */
@Controller
@RequestMapping("system")
public class PasswordController {

    @Resource
    private UserService userService;

    /**
     * 显示弹框
     * @param model
     */
    @RequestMapping("password_edit")
    public void passwordEdit(Model model) {
    }

    /**
     * 修改当前登录用户的密码
     * @param password
     * @return
     */
    @RequestMapping("password_save")
    @ResponseBody
    public Result passwordSave(String password) {
        String message = userService.passwordSave(password);
        Result result = new Result();
        result.setType("alert");
        result.setMessage(message);
        return result;
    }
}
